package customerEnter.Frame.conntroller;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

import customerEnter.Frame.Utils.DateUtils;
import customerEnter.Frame.Utils.Log4j;

public class BaseServerFrameAop {
	Long	time1	= null;
	Long	time2	= null;

	public Object CircularNotification(ProceedingJoinPoint joinpoint) {
		BaseConntrollerFrameHelp.outLog4jInfo(joinpoint);
		BaseConntrollerFrameHelp.readWithController(joinpoint);
		Object object = null;
		try {
			object = joinpoint.proceed();
			// BaseConntrollerFrameHelp.CalculationMapSen(joinpoint);
		} catch (Throwable e) {
			Log4j.Log4JOutError("代理返回數據錯誤:" + e.getMessage());
		}
		return object;
	}

	/**
	 * 最終通知　
	 */
	public void applaud(JoinPoint join) {
		time2 = DateUtils.dateToUnixTimestamp();
		Log4j.Log4jOutInfo("運行：" + (time2 - time1) + " 毫秒");
	}

	/**
	 * 異常通知
	 */
	public void doThrowing(JoinPoint jp, Throwable ex) {
		System.out.println("method " + jp.getTarget().getClass().getName() + "." + jp.getSignature().getName()
				+ " throw exception");
		System.out.println(ex.getMessage());
	}
}
